const mongoose = require('mongoose')
const Schema = mongoose.Schema
const Mixed = Schema.Types.Mixed
const ObjectId = Schema.Types.ObjectId

const courseSchema = new mongoose.Schema({
  title: { type: String, required: true },
  description: { type: String, default: '' },
  sub_category_id: { type: Mixed, default: 0 },
  top_category_id: { type: Mixed, default: 0 },
  tags: { type: String, default: '' },
  image: { type: String, default: 'course.png' },
  visitNumber: { type: Number, default: 0 },
  students: { type: [ObjectId], default: [] },
  create_id: { type: ObjectId, required: true }
})

mongoose.model('Course', courseSchema)
